package com.ithuameng.admin.app.system.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ithuameng.admin.enums.MenuType;
import com.ithuameng.admin.enums.YesNo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * 菜单表
 *
 * @author ithuameng
 */
@Data
@TableName("t_menu")
@EqualsAndHashCode(callSuper = true)
public class Menu extends AdminLogic<Long> {

    private static final long serialVersionUID = -7988668735057531004L;

    public static final String NAME = "name";

    public static final String PARENT_NAME = "parent_name";

    public static final String PARENT_ID = "parent_id";

    public static final String PATH = "path";

    public static final String COMPONENT = "component";

    public static final String DISPLAY = "display";

    public static final String PERMISSION_TYPE = "type";

    public static final String ICON = "icon";

    public static final String STATUS = "status";

    public static final String SORT_ORDER = "seq";

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 名称
     */
    private String name;

    /**
     * 父权限编号
     */
    private Long parentId;

    /**
     * 父权限名称
     */
    private String parentName;

    /**
     * 页面路径
     */
    private String path;

    /**
     * 前端组件
     */
    private String component;

    /**
     * 权限类型
     */
    private MenuType type;

    /**
     * 参数
     */
    private String query;

    /**
     * 是否为外链
     */
    private YesNo frame;

    /**
     * 是否显示
     */
    private YesNo display;

    /**
     * 是否缓存
     */
    private YesNo cache;

    /**
     * 状态
     */
    private YesNo status;

    /**
     * 图标
     */
    private String icon;

    /**
     * 排序值
     */
    private Integer seq;

    /**
     * 权限字符串
     */
    private String perms;

    @TableField(exist = false)
    private List<Menu> children = new ArrayList<>();
}
